package com.changgou.goods.feign;

import com.changgou.entity.Result;
import com.changgou.goods.pojo.Sku;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "goods")
public interface SkuFeign {

    @GetMapping("/sku/spu/{spuId}")
    public List<Sku> findSkuListBySpuId(@PathVariable("spuId") String spuId);

    @GetMapping("/sku/{id}")
    public Result<Sku> findById(@PathVariable("id") String id);

    @PostMapping("/sku/decr/count")
    public Result decrCount(@RequestParam("username") String username);

    @RequestMapping("/sku/resumeStockNum")
    public Result resumeStockNum(@RequestParam("skuId") String skuId, @RequestParam("num") Integer num);


    @RequestMapping("/sku/findSKuBySpuId")
    public Result findSKuBySpuId(@RequestParam("id") String id);

    @GetMapping(value = "/sku/search/{page}/{size}")
    public Result findPage(@RequestParam Map searchMap, @PathVariable("page") int page, @PathVariable("size") int size);


    //根据spuid删除sku
    @DeleteMapping("/sku/{id}")
    public Result delete(@PathVariable("id") String id);


    //修改sku
    @PutMapping("/sku/{id}")
    public Result update(@RequestBody Sku sku, @PathVariable("id") String id);


}
